/**
 * 
 * @param {复制文本} content 
 */
export function copyContent(content) {
  // 客户端
  if (process.client) {
    let target = null;

    target = document.createElement('div');
    target.id = 'tempTarget';
    target.style.opacity = '0';
    target.innerText = content;
    document.body.appendChild(target);

    try {
      let range = document.createRange();
      range.selectNode(target);
      window.getSelection().removeAllRanges();
      window.getSelection().addRange(range);
      document.execCommand('copy');
      window.getSelection().removeAllRanges();
    } catch (e) {
    }

    target.parentElement.removeChild(target);
  }
}

export default{
  copyContent
}